﻿<Page
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:Demo06"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:ViewModels="using:Demo06.ViewModels"
    xmlns:Interactivity="using:Microsoft.Xaml.Interactivity" xmlns:Behaviors="using:Demo06.Behaviors" xmlns:Core="using:Microsoft.Xaml.Interactions.Core"
    x:Class="Demo06.MainPage"
    xmlns:Common="using:Demo06.Common"
    mc:Ignorable="d">

    <Page.DataContext>
        <ViewModels:MainPageViewModel/>
    </Page.DataContext>

	<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
		<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center">
			<TextBox Header="Behavior" Width="400" Text="{Binding Text, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" >
				<Interactivity:Interaction.Behaviors>
					<Behaviors:OnEnterBehavior>
						<Core:InvokeCommandAction Command="{Binding Update, Mode=OneWay}"/>
					</Behaviors:OnEnterBehavior>
				</Interactivity:Interaction.Behaviors>
			</TextBox>
			<TextBox Header="Attached Property" Width="400" 
                     Common:OnEnterAttachedProperty.Command="{Binding Update}"
                     Text="{Binding Text, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
			<Button Command="{Binding Update}" Content="Update"/>
			<TextBlock Text="{Binding Result, FallbackValue=Error}" FontSize="30" />
		</StackPanel>    
	</Grid>
    
</Page>
